package my.convert.attribute.processor.impl;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

import my.convert.attribute.processor.AttributeProcessor;

public class ArrayTypeAttributeProcessor extends AttributeProcessor{

	@Override
	public Map<String, Class<?>> execute(Class<?> entityClazz, Map<String, Class<?>> mapper) {
		List<Field> fields = super.parseEntry(entityClazz);
		if(fields==null || fields.size()==0 || mapper==null)return null;
		for (Field field : fields) {
			Class<?> fieldClazz = field.getType(); // 得到field的class及类型全路径  
		    if(fieldClazz.isArray()) {    //isArray()数组  
		    	Class<?> componentType = fieldClazz.getComponentType();// getComponentType()返回表示数组组件类型的 Class。
		    	mapper.put(field.getName()+"[", componentType);
		    }
		}
		return mapper;
	}

}
